{extend name="admin/b2c/base" /}
{block name="resources"/}
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/product.css">
<style type="text/css">
.fun-a {
	margin-top: 0px;
	padding: 6px 15px 0 15px;
}
.style0list tbody td a{
	margin-left: 8px;
}
.form-horizontal .control-label{
	width: 70px;
}
.form-horizontal .controls{
	margin-left: 0px;
}
.modal-footer button{
	float: right;
	margin-right: 10px;
}
.input-error{
	font-size: 12px;
	color: #74828D;
	line-height: 30px;
	display: none;
}
.s{
	color: red;
	font-size: 18px;
	line-height: 24px;
}
label{
	font-weight: 100;
}
label input[type='radio']{
	margin-top: -1px;
	margin-right: 3px;
}
.style0list tbody td a{
	margin-left: 8px;
}	
.num{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;width:360px;display: block;}
</style>
{/block}
{block name="right_tab"}{/block}
{block name="main"}
<div class="mod-table">
	<div class="con style0list">
			<table>
				<colgroup>
					<col style="width: 1%">
					<col style="width: 10%">
					<col style="width: 40%;">
					<col style="width: 15%;">
					<col style="width: 15%;">
					<col style="width: 19%;">
				</colgroup>
				<thead>
					<tr align="center">
						<th><label><input value="" name="" id="ckall" type="checkbox" onClick="CheckAll(event)"></label></th>
						<th class="x-tab"><div class="iconbg-arrow up">姓名</div></th>
						<th class="x-tab"><div class="iconbg-arrow up">评论内容</div></th>
						<th class="x-tab"><div class="iconbg-arrow up">点赞数量</div></th>
						<th class="x-tab"><div class="iconbg-arrow up">评论时间</div></th>
						<th class="x-tab">操作</th>
					</tr>
				</thead>
				<tbody></tbody>
			</table>
		</div>
		<!--评论详情-->
	<div id="addEditArticleClass" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">评论详情</h3>
		</div>
		<div class="modal-body">
			<div class="form-horizontal">
				<div class='table-div'>
					<table>
						<tr>
							<td colspan='2' class='back-f5f5f5'><div class='table-title-font'><span>信息</span></td>
						</tr>
						<tr>
							<td class='table-1td'><label class="control-label" for="inputError">评论内容</label></td>
							<td><span id="text"></span></td>
						</tr>
						<tr>
							<td class='table-1td'><label class="control-label" for="inputError">点赞数量</label></td>
							<td><span id="up"></span></td>
						</tr>
					</table>
				</div>
			</div>
		</div>
		<div class="modal-footer" style='text-align:center;'>
			<button class="btn" data-dismiss="modal" aria-hidden="true" style='padding:10px 35px;'>关闭</button>
		</div>
	</div>
	<!--end 发货地址-->
	<input type="hidden" name="comment_id" id="comment_id" value="" />
</div>
{/block}
{block name="script"}
{include file="admin/b2c/pageCommon" /}
{include file="admin/b2c/openDialog" /}
<script type="text/javascript">
$(function(){
	//弹框添加关闭
	$('[aria-hidden="true"]').click(function(){
		$(this).parents('div[role="dialog"]').hide();
	})
})
//分页数据
function LoadingInfo(pageIndex) {
	var search_text = $("#search_text").val();
	$.ajax({
		type : "post",
		url : "ADMIN_MAIN/Cms/commentArticle",
		async : true,
		data : { "pageIndex" : pageIndex, "search_text" : search_text },
		success : function(data) {
			$("#page_count").val(data["page_count"]);
			$("#pageNumber a").remove();
			var html = '';
			if (data["data"].length > 0) {
				for (var i = 0; i < data["data"].length; i++) {
					html += '<tr align="center">';
					html += '<td><div class="cell"><label ><input name="sub" type="checkbox" value="'+ data['data'][i]['article_id']+'" ></label></div></td>';
					html += '<td>' + data["data"][i]["member_name"]+ '</td>';
					html += '<td class="num">' + data["data"][i]["text"]+ '</td>';
					html += '<td>' + data["data"][i]["up"]+ '</td>';
					html += '<td>' + data["data"][i]["comment_time"]+ '</td>';
					html += '<td><a href="javascript:comment_detaile('+data['data'][i]['comment_id']+');">详情</a><a style="cursor: pointer;" onclick="comment_delete('+data['data'][i]['comment_id']+')">删除</a></td> ';
					html += '</tr>';
				}
			} else {
				html += '<tr align="center"><th colspan="9">暂无评论</th></tr>';
			}
			$(".style0list tbody").html(html);
			var totalpage = $("#page_count").val();
			if (totalpage == 1) {
				changeClass("all");
			}
			var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
			$("#pageNumber").append($html);
		}
	});
}

//弹框显示
function comment_detaile(comment_id){
	$('#comment_id').val(comment_id);
	if(comment_id>0){
		$.ajax({
			type:'post',
			url:'ADMIN_MAIN/Cms/comment_detaile',
			data:{'comment_id':comment_id},
			async:true,
			success:function(data){
				$('#text').text(data['text']);
				$('#up').text(data['up']);
				$("#addEditArticleClass").show();
			}
		});
	}else{
		$('#text').text('');
		$('#up').text('0');
		$("#addEditArticleClass").show();
	}
}

//删除评论
function comment_delete(comment_id){
	$( "#dialog" ).dialog({
		buttons: {
			"确定,#e57373": function() {
				$(this).dialog('close');
				$.ajax({
					type : "post",
					url : "ADMIN_MAIN/Cms/comment_delete",
					async : true,
					data : {
						"comment_id" : comment_id
					},
					dataType : "json",
					success : function(data) {
						if (data["code"] > 0) {
							showMessage('success', data["message"]);
							LoadingInfo(1);
						}else{
							showMessage('error', data["message"]);
						}
					}
				})
			},
			"取消": function() {
				$(this).dialog('close');
			}
		},
		contentText:"是否删除评论？",
	});
}
</script>
{/block}